<?php
namespace App\Libs\Commons;

class MyAuth {
	/**
	 * 使用openssl_encrypt加密
	 * $data = '1234567887654321';//加密明文
	 * $method = 'DES-ECB';//加密方法
	 * $passwd = '202011028';//加密密钥
	 * $options = 0;//数据格式选项（可选）
	 * $iv = '';//加密初始化向量（可选）
	 *
	 */
	
	static public function encrypt($data, $passwd = '202011028', $method = 'DES-ECB', $options = 0, $iv = '')
	{
		return openssl_encrypt($data, $method, $passwd, $options);
	}
	
	/**
	 * 使用openssl_decrypt解密
	 *
	 */
	static public function decrypt($data, $passwd = '202011028', $method = 'DES-ECB', $options = 0, $iv = '')
	{
		return openssl_decrypt($data, $method, $passwd, $options);
	}
}